<?php
$checked = ($model['status']==0)?'checked':'';

?>
<div class="container-fluid">
    <!-- BEGIN PAGE HEADER-->
    <div class="row-fluid">
        <div class="span12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <h3 class="page-title">
                Quản lý Tin tức
            </h3>
            <ul class="breadcrumb">
                <li>
                    <i class="icon-home"></i>
                    <a href="index.html">Trang chủ</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li>
                    <a href="#">Tin tức</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">Cập nhật tin tức</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->
        </div>
    </div>
    <!-- END PAGE HEADER-->

    <!-- BEGIN PAGE CONTENT-->
    <div class="row-fluid">
        <div class="span12">
            <!-- BEGIN EXAMPLE TABLE PORTLET-->
            <div class="portlet box light-grey">
                <div class="portlet-title">
                    <h4><i class="icon-plus-sign"></i>Thêm mới bài viết</h4>
                    <div class="tools">
                        <a href="javascript:;" class="collapse"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <!-- BEGIN FORM-->
                        <?php $form=$this->beginWidget('CActiveForm', array(
                        'id'=>'news-form',
                        'action'=> $this->createUrl('news/update', array('id'=>$model['id'])),
                        'htmlOptions' => array('class'=>'horizontal-form', 'enctype' => 'multipart/form-data'),
                        'enableAjaxValidation'=>false
                    )); ?>
                        <div class="row-fluid">
                            <div class="span6 ">
                                <div class="control-group">
                                    <label class="control-label" for="firstName">Tiêu đề</label>
                                    <div class="controls">
                                        <input type="text" id="News_title" class="m-wrap span12" placeholder="" name="News[title]" value="<?=$model['title']?>">
                                    </div>
                                </div>
                            </div>
                            <!--/span-->
                            <div class="span6 ">
                                <div class="control-group">
                                    <label class="control-label">Hiển thị</label>
                                    <div class="controls">
                                        <label class="radio">
                                            <div class="radio" id="uniform-undefined"><span class="<?=($model['status']==0)?'checked':''?>"><input name="News[status]" type="radio" <?=($model['status']==0)?'checked':''?>  value="0" id= "News_status" style="opacity: 0;"></span></div>
                                            Có
                                        </label>
                                        <label class="radio">
                                            <div class="radio" id="uniform-undefined"><span class="<?=($model['status']==1)?'checked':''?>"><input <?=($model['status']==1)?'checked':''?> type="radio" value="1"  name="News[status]" id= "News_status" style="opacity: 0;"></span></div>
                                            Không
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <!--/span-->
                        </div>
                        <!--/row-->
                        <div class="row-fluid">
                            <div class="span2">Ảnh thumb:</div>
                            <div class="span10"><?php echo $form->fileField($model, 'image'); ?>
                                <?php echo $form->error($model,'image'); ?>
                            </div>
                        </div>
                        <?php if($model->isNewRecord!='1'){ ?>
                        <div class="row-fluid">
                            <?php echo CHtml::image(Yii::app()->request->baseUrl.'/data/images/img-news/'.$model->image,"image",array("width"=>150)); ?>
                        </div>
                        <?php }?>
                        <div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <label class="control-label" >Mô tả ngắn</label>
                                    <div class="controls">
                                        <textarea style="width:50%" class="m-wrap" placeholder="Sử dụng text editor cho bai viet" name="News[description]" class="ckeditor"><?=$model['description']?></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <label class="control-label" >Bài viết</label>
                                    <div class="controls">
                                        <textarea style="width:98%" rows="3" class="m-wrap" placeholder="Sử dụng text editor cho bai viet" name="News[content]" id="ckeditor" ><?=$model['content']?></textarea>
                                    </div>
                                </div>
                            </div>

                            <!--/span-->
                        </div>
                        <!--/row-->

                        <div class="form-actions">
                            <button type="submit" class="btn blue"><i class="icon-ok"></i> Lưu</button>
                            <button type="button" class="btn" onclick="window.location='/admin/news/index'">Hủy</button>
                        </div>
                    <?php $this->endWidget(); ?>
                    <!-- END FORM-->
                </div>
            </div>
            <!-- END EXAMPLE TABLE PORTLET-->
        </div>
    </div>

    <!-- END PAGE CONTENT-->
</div>

<!-- END PAGE CONTENT-->
</div>